package com.baofu.paycore.service.processor.transfer;

import com.baofu.paycore.common.utils.Constant;
import com.baofu.paycore.manager.model.TransferBO;
import com.baofu.paycore.service.converter.DTO2BOConverter;
import com.baofu.paycore.service.facade.model.transfer.TransferDTO;
import com.baofu.paycore.service.processor.PayBaseProcessor;
import org.springframework.stereotype.Component;

/**
 * 转账主单处理类
 *
 * <p/>
 *      1、构建支付属性
 * </p>
 * User: LZQ Date: 2016/04/20  Version: 1.0
 */
@Component
public class TransferProcessor implements PayBaseProcessor<TransferBO,TransferDTO> {

    /**
     * 构建支付属性
     *
     * @param transferBO      支付模型
     * @param transferDTO     请求参数
     */
    @Override
    public PayBaseProcessor process(TransferBO transferBO, TransferDTO transferDTO) {

        DTO2BOConverter.getTransferBOByDTO(transferDTO, transferBO);

        transferBO.setEventNo(transferDTO.getEventNo());
        transferBO.setBizChargeAmt(Constant.validateLong(transferDTO.getBizChargeAmt()));
        transferBO.setBizFeeAccount(transferDTO.getTransferOutDTO().getAccountNo());
        transferBO.setFeeFlag(transferDTO.getFeeFlag());
        return this;
    }
}
